//
//  BaseViewController.m
//  PhongThuyHuongNha
//
//  Created by Le Anh Tai on 9/28/13.
//  Copyright (c) 2013 Le Anh Tai. All rights reserved.
//

#import "BaseViewController.h"
#import "UIConstants.h"
#import "Utility.h"

@interface BaseViewController ()

@end

@implementation BaseViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view.
}

- (void)viewWillAppear:(BOOL)animated
{
    if (_statusBackgroundView == nil)
    {
        NSInteger offsetTop = [Utility offsetTopForViewController];
        _statusBackgroundView = [[UIView alloc]initWithFrame:RECT(0, -offsetTop, self.view.width, offsetTop)];
        _statusBackgroundView.backgroundColor = [self colorForStatusBackgroundView];
        _statusBackgroundView.autoresizingMask = (UIViewAutoresizingFlexibleWidth);
        
        [[self parentViewForStatusBackgroundView] addSubview:_statusBackgroundView];
    }
}

- (UIView *)parentViewForStatusBackgroundView
{
    return self.view;
}

- (UIColor *)colorForStatusBackgroundView
{
    //overwrite me;
    return [UIColor clearColor];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



@end
